<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:insert="~{common :: commomcss}"></head>
  <body>
  <!-- navbar-->
  <div th:replace="~{common :: commonheader}"></div>
  <div class="d-flex align-items-stretch">
    <div id="sidebar" class="sidebar py-3">
      <ul th:insert="~{common :: siderul}"></ul>
    </div>
    <div class="page-holder w-100 d-flex flex-wrap">
      <div class="container-fluid px-xl-5">
        <section class="py-5">
          <div class="row">

            <div class="col-lg-12 mb-12">
              <div class="card">
                <div class="card-header">
                  <h6 class="text-uppercase mb-0">
                    <td th:text="${session.grade.getGradename()}"></td>-<td th:text="${session.course.getCoursename()}"></td>
                  </h6>
                </div>
                <div class="card-body">
                  <table class="table table-striped table-hover card-text">
                    <thead>
                    <tr>
                      <th>#</th>
                      <th>学号</th>
                      <th>姓名</th>
                      <th>批阅</th>
                      <th>分数(百分制 鼠标离开即保存)</th>
                      <th>上次批阅时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="studentWork : ${studentWorkVOList}">
                      <th scope="row" th:text="${studentWorkStat.count}"></th>
                      <td th:text="${studentWork.getStudent_id()}"></td>
                      <td th:text="${studentWork.getStudentname()}"></td>
                      <!--使用 POBrowser.openWindowModeless(url, 'width:100%;height:700px') -->
                      <td><a th:href="@{/pageoffice/readWord(workid=${studentWork.getWork().getId()})}" target="_blank">👁</a></td>
                      <td th:if="${studentWork.getWork().getScore() == null}" class="score" th:href="${studentWork.getWork().getId()}">
                        <input type="text" value="0" onblur="" th:id="${studentWork.getWork().getId()}"/></td>
                      <td th:if="${studentWork.getWork().getScore()}" class="score">
                        <input type="text" th:id="${studentWork.getWork().getId()}" th:value="${studentWork.getWork().getScore()}" onblur=""/>
                      </td>
                      <td th:text="${studentWork.getWork().getReaddate()}"></td>
                    </tr>

                    </tbody>
                  </table>
                </div>
              </div>
            </div>

          </div>
        </section>
      </div>
    </div>
  </div>
    <!-- JavaScript files-->
    <div th:insert="~{common :: commomjs}"></div>
    <script type="text/javascript">
      $(function () {
        // 页面加载完毕
        $("input").blur(function () {
          var workid = $(this).attr("id");
          var score = $(this).val();
          console.log(workid);
          $.ajax({
            url:"/teacher/saveScore?workid="+workid+"&score="+score
          });
        });

      })
    </script>
  </body>
</html>